<template>
	<div class="address-info" >
		<el-descriptions :column="3" border>
			<el-descriptions-item label="收货人">{{ form.consignee || '-' }}</el-descriptions-item>
			<el-descriptions-item label="收货电话">{{ form.tel || '-' }}</el-descriptions-item>
			<el-descriptions-item label="收货手机">{{ form.phone || '-' }}</el-descriptions-item>
			<el-descriptions-item label="真实姓名">{{ form.realName || '-' }}</el-descriptions-item>
			<el-descriptions-item label="省市区">{{ form.addrBrief || '-' }}</el-descriptions-item>
			<el-descriptions-item label="邮编">{{ form.postcode || '-' }}</el-descriptions-item>
			<el-descriptions-item label="身份证">{{ form.idCard || '-' }}</el-descriptions-item>
			<el-descriptions-item label="收货地址" :span="3">{{ form.address || '-' }}</el-descriptions-item>
			<el-descriptions-item label="备注" :span="3">{{ form.remark || '-' }}</el-descriptions-item>
		</el-descriptions>
	</div>
</template>

<script>
import {
  getPrepareDelivery
} from "@/api/mes/sales/prepare";
export default {
	name: 'addressForm',
	props: {
		cellId: {
			type: String,
			default: ''
		}
	},
	watch: {
		cellId: {
			immediate: true,
			handler(newVal) {
				if (newVal && newVal !== 'add') {
					getPrepareDelivery(newVal).then(res => {
						if (res.code === 200) {
							this.form = res.data;
						}
					})
				} else {
					this.form = {
						consignee: '',
						tel: '',
						phone: '',
						realName: '',
						addrBrief: [],
						postcode: '',
						idCard: '',
						address: '',
						remark: ''
					};
				}
			}
		}
	},
	data() {
		return {
			form: {
				consignee: '',
				tel: '',
				phone: '',
				realName: '',
				addrBrief: [],
				postcode: '',
				idCard: '',
				address: '',
				remark: ''
			},
		};
	},
	methods: {
	}
}
</script>

<style lang="scss" scoped>
el-form {
	background: #fff;
}

.address-info {
	background: #fff;
	 ::v-deep.el-descriptions-item__label {
        width: 120px;
        min-width: 120px;
      }
}
</style>

